﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Waiter.Common;

namespace Waiter.View
{
    public partial class FrmInputText : DevComponents.DotNetBar.Office2007Form
    {
        public FrmInputText()
        {
            InitializeComponent();
        }

        public void fsSetDialogInfo(string title, bool require)
        {
            CommonLogging.fsWriteLog(CommonConstants.LOG_TYPE_INFO, "FrmInputText.fsSetDialogInfo", "", "");
            this.lblTitle.Text = title;
            this.lblRequirement.Visible = require;
        }

        public string fsGetInputText()
        {
            CommonLogging.fsWriteLog(CommonConstants.LOG_TYPE_INFO, "FrmInputText.fsGetInputText", "", "");
            return this.txtInputText.Text;
        }

        private void FrmInputText_Load(object sender, EventArgs e)
        {
            CommonLogging.fsWriteLog(CommonConstants.LOG_TYPE_INFO, "FrmInputText.FrmInputText_Load", "", "");
            this.txtInputText.Focus();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            CommonLogging.fsWriteLog(CommonConstants.LOG_TYPE_INFO, "FrmInputText.btnOk_Click", "", "");
            if (this.lblRequirement.Visible)
            {
                string str = this.txtInputText.Text.Trim();
                if (str == string.Empty)
                {
                    this.txtInputText.Clear();
                    this.txtInputText.Focus();
                    return;
                }
            }


            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            CommonLogging.fsWriteLog(CommonConstants.LOG_TYPE_INFO, "FrmInputText.btnCancel_Click", "", "");
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}


